package com.pqc.tbk.utils;

import org.apache.shiro.SecurityUtils;

import com.pqc.tbk.service.account.ShiroDbRealm.ShiroUser;

/**
 * 
 * @author long, create on 2012-8-6 下午5:45:32
 * 
 */
public class UserUtil {

	/**
	 * 获取用户id
	 * 
	 * @return
	 */
	public static Long getUID() {
		if (getShiroUser() != null) {
			return getShiroUser().getId();
		} else {
			return -1L;
		}
	}

	/**
	 * 获取shiroUser的信息
	 * 
	 * @return
	 */
	public static ShiroUser getShiroUser() {
		return (ShiroUser) SecurityUtils.getSubject().getPrincipal();
	}

}
